using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Markup;

namespace Hearthbuddy.Windows
{
	/// <summary>
	/// Interaction logic for ProcessSelectorWindow.xaml
	/// </summary>
	/// <summary>
	/// ProcessSelectorWindow
	/// </summary>
	public partial class ProcessSelectorWindow : Window, IComponentConnector
	{
		[CompilerGenerated]
		private Process process_0;

		//internal ListBox listBox_0;

		//internal Button button_0;

		private bool bool_0;

		public Process Selected
		{
			[CompilerGenerated]
			get
			{
				return process_0;
			}
			[CompilerGenerated]
			set
			{
				process_0 = value;
			}
		}

		public ProcessSelectorWindow(Dictionary<Process, string> availableProcs)
		{
			InitializeComponent();
			foreach (KeyValuePair<Process, string> availableProc in availableProcs)
			{
				ListBoxItem newItem = new ListBoxItem
				{
					Content = availableProc.Value + " [PID: " + availableProc.Key.Id + "]",
					Tag = availableProc.Key
				};
				listBox_0.Items.Add(newItem);
			}
			if (listBox_0.Items.Count == 1)
			{
				listBox_0.SelectedItem = listBox_0.Items[0];
			}
			button_0.Focus();
			Keyboard.Focus(button_0);
		}

		private void button_0_Click(object sender, RoutedEventArgs e)
		{
			ListBoxItem listBoxItem = listBox_0.SelectedItem as ListBoxItem;
			if (listBoxItem == null)
			{
				MessageBox.Show("You must select a process from the list first!");
				return;
			}
			Selected = listBoxItem.Tag as Process;
			base.DialogResult = true;
			Close();
		}
		/*
		/// <summary>
		/// InitializeComponent
		/// </summary>
		[DebuggerNonUserCode]
		[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
		public void InitializeComponent()
		{
			if (!bool_0)
			{
				bool_0 = true;
				Uri resourceLocator = new Uri("/Hearthbuddy;component/windows/processselectorwindow.xaml", UriKind.Relative);
				Application.LoadComponent(this, resourceLocator);
			}
		}

		[DebuggerNonUserCode]
		[EditorBrowsable(EditorBrowsableState.Never)]
		[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
		void IComponentConnector.Connect(int connectionId, object target)
		{
			switch (connectionId)
			{
			default:
				bool_0 = true;
				break;
			case 2:
				button_0 = (Button)target;
				button_0.Click += button_0_Click;
				break;
			case 1:
				listBox_0 = (ListBox)target;
				break;
			}
		}*/
	}
}
